<template>
  <div class="comitem">
    <div class="top">
      <div class="uimg">
        <img :src="item.user.avatarUrl | imgURL(50)" />
      </div>
      <div class="uname">
        <h3>{{ item.user.nickname }}</h3>
        <span>{{ date }}</span>
      </div>
      <div class="good">
        <span>{{ item.likedCount }}</span>
        <img src="../assets/e9z.png" alt="" />
      </div>
    </div>
    <div class="content">
      {{ item.content }}
    </div>
  </div>
</template>

<script>
export default {
  props: ["item"],
  computed: {
    date() {
      let oDate = new Date(this.item.time);
      return (
        oDate.getFullYear() +
        "年" +
        (oDate.getMonth() + 1 > 9
          ? oDate.getMonth() + 1
          : "0" + (oDate.getMonth() + 1)) +
        "月" +
        (oDate.getDate() > 9 ? oDate.getDate() : "0" + oDate.getDate()) +
        "日"
      );
    },
  },
};
</script>

<style lang="less" scoped>
.comitem {
  padding-top: 10px;
  .top {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    padding-right: 15px;
    .uimg {
      width: 9vw;
      height: 9vw;
      border-radius: 50%;
      overflow: hidden;
      //   margin-left: 10px;
      img {
        vertical-align: middle;
      }
    }
    .uname {
      flex: 1;
      margin-left: 5px;
      //   text-align: left;
      h3 {
        font-size: 13px;
        line-height: 12px;
      }
      span {
        display: inline-block;
        font-size: 12px;
        transform-origin: left;
        transform: scale(0.9);
        color: #bbb;
      }
    }
    .good {
      display: flex;
      align-items: center;
      img {
        width: 5vw;
        margin-left: 5px;
      }
      span {
        font-size: 12px;
        color: #bbb;
      }
    }
  }
  .content {
    padding-right: 20px;
    margin-left: calc(9vw + 5px);
    font-size: 13px;
    line-height: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
  }
}
</style>